<%@ page import="java.io.File" %><%--
  Created by IntelliJ IDEA.
  User: 19666
  Date: 2022/8/18
  Time: 15:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>上传的文件列表</title>
    <!-- 1、引入bs的css样式-->
    <link rel="stylesheet" href="/webjars/bootstrap/3.4.1/css/bootstrap.min.css">
    <!-- 2、引入jquery依赖-->
    <script src="/webjars/jquery/3.6.0/jquery.min.js"></script>
    <!--  3、引入bs的js库-->
    <script src="/webjars/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">已经上传的文件列表</h3>
        </div>
        <div class="panel-body">
            <%
                // 1、得到/upload的真实路径
                String realPath = application.getRealPath("/upload");
                // 2、得到该路径下的全部文件
                File file = new File(realPath);
                File[] files = file.listFiles();
                for (File file1 : files) {
                    out.println("<li>");
                    out.println("<a href=''>" + file1.getName() + "</a>");
                    out.println("</li>");
                }
            %>
        </div>
    </div>
</div>
</body>
</html>
